import { NextApiRequest, NextApiResponse } from "next";

import { getUsers } from "@/services";

async function getUserList(req: NextApiRequest, res: NextApiResponse<APIRes>) {
    await getUsers(req, res);
}

export default async function handler(
    req: NextApiRequest,
    res: NextApiResponse<APIRes>
) {
    if (req.method === "GET") {
        getUserList(req, res);
    } else {
        res.status(405).json({
            success: false,
            data: {},
            message: "Method not allowed",
        });
    }
}
